<!--
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-11-23 11:32:58
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2022-11-23 15:29:16
 * @FilePath: \grazlink20\uc_sys\src\components\TEditor\src\TEditor.vue
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved. 
-->
<script setup lang="ts">
import { ref, watch } from 'vue'
import Editor from '@tinymce/tinymce-vue'
import { propTypes } from '@/utils/propTypes'
const props = defineProps({
  modelValue: propTypes.string.def('')
})
const content = ref(props.modelValue)
const emit = defineEmits(['update:modelValue'])
watch(content, (content) => {
  if (content != props.modelValue) {
    emit('update:modelValue', content)
  }
})
</script>
<template>
  <editor
    v-model="content"
    :init="{
      plugins: 'lists link image table code help wordcount',
      language_url: 'https://api.user.grazlink.com/js/tinymce/langs/zh-Hans.js',
      language: 'zh-Hans',
      menubar: false,
      api_key: 'rmv5k6p5d979q628c9cqin1zjb8zw7zkwdnkymjxiko1onte' //好像还是解决不了弹出问题，英语不行 不知道这么注册key
    }"
  />
</template>
